package com.itheima_01;

import java.util.ArrayList;

public class Test02 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        addElement(list,"abc","cba","aaa","bbb");
        System.out.println(list);

        ArrayList<Integer> list1 = new ArrayList<>();
        addElement(list1,1,2,3,4,5);
        System.out.println(list1);
    }
    public static <E> void addElement(ArrayList<E> list,E...e){
        for (E e1 : e) {
            list.add(e1);
        }
    }
}
